﻿using Admin.CYT369.Com.WebBase;
using Microsoft.AspNetCore.Mvc;

namespace brand.admin.cyt369.com.Areas.BrandAdmin.Controllers
{
    public partial class HotBrandController 
    {
        /// <summary>
        /// 获取热门品牌
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetsHotBrand()
        {
            int page = Request.Query.GetInteger("page", 0);
            int rows = Request.Query.GetInteger("rows", 20);
            int total = 0;

            string title = Request.Query.GetString("Title");

            var brands = brand.admin.cyt369.com.services.Services.HotBrandService.Instance.GetsHotBrand(page, rows, ref total, name: title);

            return DefaultJson(brands);
        }

        /// <summary>
        /// 获取非热门品牌
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetsNoHotBrand()
        {
            var hotBrands = brand.admin.cyt369.com.services.Services.HotBrandService.Instance.GetsNoHotBrand();
            return DefaultJson(hotBrands);
        }

        /// <summary>
        /// 删除热门品牌
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public IActionResult HotBrandDelete(int id)
        {
            var retVal = new Admin.CYT369.Com.WebBase.ExecuteResult();
            retVal.Result = brand.admin.cyt369.com.services.Services.HotBrandService.Instance.HotBrandDelete(id);
            if (retVal.Result == false)
            {
                retVal.Msg = "删除失败";
            }
            return DefaultJson(retVal);
        }
    }
}
